#include "coada.h"
#include <iostream>
template<class T>Coada<T>::Coada(){
  (*this).cap=NULL;
	(*this).baza=NULL;
  (*this).nr=0;
}
template<class T>bool Coada<T>::isEmpty()const{
  return (*this).cap==NULL;
}
template<typename T>int Coada<T>::size()const{
  return (*this).nr;
}
template<typename T>void Coada<T>::add(T ob){
  if(isEmpty())
  {
      (*this).cap=new Nod;
      (*this).cap->info=ob;
      (*this).cap->urm=NULL;
      (*this).baza=(*this).cap;
      nr=1;
  }
  else
  {
      Nod *p=new Nod;
      p->info=ob;
      p->urm=NULL;
      (*this).baza->urm=p;
      (*this).baza=p;
      ++nr;
  }
}
template<typename T>void Coada<T>::eliminare(){
  if(isEmpty()) std::cout<<"Eroare! Coada Vida!";
  Nod *q=(*this).cap; // Salvez elementul din cap
  (*this).cap=(*this).cap->urm; // Elementul urmator devine cap
  delete q;
  --nr;
}

template<typename T>Coada<T>::~Coada(){
	delete (*this).cap;
}
template<typename T>T Coada<T>::listFata()const{
    if(isEmpty()) std::cout<<"Eroare! Coada Vida!";
    return (*this).cap->info;
}
